const path = require('path')
const DonePlugin = require('./plugins/DonePlugin')
const AsyncPlugin = require('./plugins/AsyncPlugin')
const ResourcePlugin = require('./plugins/ResourcePlugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const inlineSourcePlugin = require('./plugins/inlineSourcePlugin')

module.exports = {
  mode: 'development',
  entry: path.resolve(__dirname,'src/index.js'),
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  },
  module: {
    rules: [
      {
        test: /\.css/,
        use: [MiniCssExtractPlugin.loader, 'css-loader']
      }
    ]
  },
  plugins: [
    // new DonePlugin(),
    // new AsyncPlugin(),
    new HtmlWebpackPlugin({
      template: path.resolve(__dirname, 'public/index.html'),
      filename: 'index.html'
    }),
    new ResourcePlugin({
      filename: 'resourceList.md'
    }),
    new MiniCssExtractPlugin({
      filename: 'main.css'
    }),
    new inlineSourcePlugin({
      reg: /\.(js|css)$/
    })
  ]
}